using System.ComponentModel.DataAnnotations;

namespace MediPlatform.Read.Api.Models
{
    /// <summary>
    /// 处方流转订单查询请求模型
    /// </summary>
    public class PrescriptionOrderQueryRequest
    {
        /// <summary>
        /// 患者姓名或手机号
        /// </summary>
        public string? PatientNameOrPhone { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 订单状态：0-待支付, 1-已完成, 2-已失效, null-全部
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        [Range(1, int.MaxValue)]
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        [Range(1, 100)]
        public int PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 处方流转订单列表项响应模型
    /// </summary>
    public class PrescriptionOrderListItem
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        public string? OrderNo { get; set; }

        /// <summary>
        /// 处方编号
        /// </summary>
        public string? PrescriptionNo { get; set; }

        /// <summary>
        /// 患者姓名
        /// </summary>
        public string? PatientName { get; set; }

        /// <summary>
        /// 患者手机号
        /// </summary>
        public string? PatientPhone { get; set; }

        /// <summary>
        /// 科室名称
        /// </summary>
        public string? DepartmentName { get; set; }

        /// <summary>
        /// 医生姓名
        /// </summary>
        public string? DoctorName { get; set; }

        /// <summary>
        /// 费用
        /// </summary>
        public decimal? PaymentAmount { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 订单状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 处方单状态
        /// </summary>
        public int? PrescriptionStatus { get; set; }

        /// <summary>
        /// 处方单状态文本
        /// </summary>
        public string? PrescriptionStatusText { get; set; }

        /// <summary>
        /// 购药方式
        /// </summary>
        public string? PurchaseMethod { get; set; }

        /// <summary>
        /// 发药状态
        /// </summary>
        public string? DispensingStatus { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; }
    }

    /// <summary>
    /// 处方流转订单分页响应模型
    /// </summary>
    public class PrescriptionOrderPagedResponse
    {
        /// <summary>
        /// 订单列表
        /// </summary>
        public List<PrescriptionOrderListItem> Items { get; set; } = new();

        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; }
    }

    /// <summary>
    /// 处方流转订单详情响应模型
    /// </summary>
    public class PrescriptionOrderDetailResponse
    {
        /// <summary>
        /// 订单信息
        /// </summary>
        public PrescriptionOrderInfo OrderInfo { get; set; } = new();

        /// <summary>
        /// 处方信息
        /// </summary>
        public PrescriptionInfo PrescriptionInfo { get; set; } = new();

        /// <summary>
        /// 流转日志
        /// </summary>
        public List<PrescriptionLogInfo> Logs { get; set; } = new();
    }

    /// <summary>
    /// 处方流转订单信息
    /// </summary>
    public class PrescriptionOrderInfo
    {
        /// <summary>
        /// 订单ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 订单编号
        /// </summary>
        public string? OrderNo { get; set; }

        /// <summary>
        /// 处方ID
        /// </summary>
        public long? PrescriptionId { get; set; }

        /// <summary>
        /// 患者ID
        /// </summary>
        public long? PatientId { get; set; }

        /// <summary>
        /// 患者姓名
        /// </summary>
        public string? PatientName { get; set; }

        /// <summary>
        /// 患者手机号
        /// </summary>
        public string? PatientPhone { get; set; }

        /// <summary>
        /// 医生ID
        /// </summary>
        public long? DoctorId { get; set; }

        /// <summary>
        /// 医生姓名
        /// </summary>
        public string? DoctorName { get; set; }

        /// <summary>
        /// 药店ID
        /// </summary>
        public long? PharmacyId { get; set; }

        /// <summary>
        /// 药店名称
        /// </summary>
        public string? PharmacyName { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 订单状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 支付状态
        /// </summary>
        public int? PaymentStatus { get; set; }

        /// <summary>
        /// 支付状态文本
        /// </summary>
        public string? PaymentStatusText { get; set; }

        /// <summary>
        /// 支付金额
        /// </summary>
        public decimal? PaymentAmount { get; set; }

        /// <summary>
        /// 优惠金额
        /// </summary>
        public decimal? DiscountAmount { get; set; }

        /// <summary>
        /// 支付方式
        /// </summary>
        public string? PaymentMethod { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime? PaymentTime { get; set; }

        /// <summary>
        /// 配送地址
        /// </summary>
        public string? DeliveryAddress { get; set; }

        /// <summary>
        /// 物流公司
        /// </summary>
        public string? LogisticsCompany { get; set; }

        /// <summary>
        /// 物流单号
        /// </summary>
        public string? TrackingNumber { get; set; }

        /// <summary>
        /// 签收时间
        /// </summary>
        public DateTime? SignTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedAt { get; set; }
    }

    /// <summary>
    /// 处方信息
    /// </summary>
    public class PrescriptionInfo
    {
        /// <summary>
        /// 处方ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 处方编号
        /// </summary>
        public string? PrescriptionNo { get; set; }

        /// <summary>
        /// 患者ID
        /// </summary>
        public long? PatientId { get; set; }

        /// <summary>
        /// 医生ID
        /// </summary>
        public long? DoctorId { get; set; }

        /// <summary>
        /// 医院ID
        /// </summary>
        public long? HospitalId { get; set; }

        /// <summary>
        /// 医院名称
        /// </summary>
        public string? HospitalName { get; set; }

        /// <summary>
        /// 科室ID
        /// </summary>
        public long? DepartmentId { get; set; }

        /// <summary>
        /// 科室名称
        /// </summary>
        public string? DepartmentName { get; set; }

        /// <summary>
        /// 诊断结果
        /// </summary>
        public string? Diagnosis { get; set; }

        /// <summary>
        /// 处方状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 处方状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 有效期截止时间
        /// </summary>
        public DateTime? ValidUntil { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; }
    }

    /// <summary>
    /// 处方流转日志信息
    /// </summary>
    public class PrescriptionLogInfo
    {
        /// <summary>
        /// 日志ID
        /// </summary>
        public long? Id { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public long? OrderId { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 状态文本
        /// </summary>
        public string? StatusText { get; set; }

        /// <summary>
        /// 操作人员ID
        /// </summary>
        public long? OperatorId { get; set; }

        /// <summary>
        /// 操作人员姓名
        /// </summary>
        public string? OperatorName { get; set; }

        /// <summary>
        /// 操作时间
        /// </summary>
        public DateTime? OperateTime { get; set; }

        /// <summary>
        /// 操作备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; }
    }

    /// <summary>
    /// 处方流转订单统计响应模型
    /// </summary>
    public class PrescriptionOrderStatisticsResponse
    {
        /// <summary>
        /// 总订单数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 待支付订单数
        /// </summary>
        public int PendingPaymentCount { get; set; }

        /// <summary>
        /// 已完成订单数
        /// </summary>
        public int CompletedCount { get; set; }

        /// <summary>
        /// 已失效订单数
        /// </summary>
        public int InvalidatedCount { get; set; }
    }
} 